import java.util.List;

public class TravelCompany
{
    // IO instance
    public static IO io;
    
    // @SuppressWarnings("deprecation")
    public static void main(String[] args)
    {
        // IO File input
        String fileName = (args.length > 0) ? args[0] : "basic.txt";
        
        io = new IO(fileName);
        List<TourOffering> tourOfferings = io.readFile();
        
        Scheduler[] schedulers = {
                new SchedulerD(),
                new SchedulerC(),
                new SchedulerB(),
                new SchedulerA()
        };
        
        // go through offerings
        for (TourOffering offering : tourOfferings)
        {
            System.out.print(offering.toString() + "\n");
            boolean scheduled = false;
            
            for (int i = 0; i < schedulers.length; i++)
            {
                scheduled = schedulers[i].schedule(offering);
                System.out.println(schedulers[i].getMessage());
                
                if (scheduled)
                    break;
            }
            
            System.out.print("\nTour offering was " + (scheduled ? "" : "not ") + "scheduled");
            
            // if we scheduled, print rooms required
            if (scheduled)
                System.out.println(" with " + offering.getRoomsRequired() + " rooms.");
            
            System.out.print("\n=================================================\n\n");
        }
        
    }
}
